<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>产品详情 - OKX 数据展示</title>
    <link rel="stylesheet" th:href="@{/css/bootstrap.min.css}">
    <style>
        body {
            background-color: #f4f7fa;
            font-family: Arial, sans-serif;
        }
        .navbar {
            background-color: #0c2461;
        }
        .card {
            border-radius: 10px;
            box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
            margin-bottom: 20px;
        }
        .card-header {
            background-color: #0c2461;
            color: white;
            border-radius: 10px 10px 0 0;
            padding: 15px;
            font-weight: bold;
        }
        .detail-row {
            margin-bottom: 1rem;
            padding-bottom: 1rem;
            border-bottom: 1px solid #e9ecef;
        }
        .detail-label {
            font-weight: 600;
            color: #495057;
        }
        .detail-value {
            font-size: 1.1rem;
        }
        .badge-spot {
            background-color: #0c2461;
        }
        .badge-swap {
            background-color: #27ae60;
        }
        .badge-futures {
            background-color: #8e44ad;
        }
    </style>
</head>
<body>
    <!-- 引入导航栏片段 -->
    <div th:replace="fragments/navbar :: navbar"></div>

    <div class="container">
        <div class="card">
            <div class="card-header d-flex justify-content-between align-items-center">
                <span>产品详情</span>
                <div>
                    <a th:href="@{/accounts/edit/{id}(id=${account.id})}" class="btn btn-sm btn-warning">编辑</a>
                    <a href="/accounts" class="btn btn-sm btn-outline-light ms-2">返回列表</a>
                </div>
            </div>
            <div class="card-body">
                <div class="row detail-row">
                    <div class="col-md-3 detail-label">产品ID</div>
                    <div class="col-md-9 detail-value" th:text="${account.id}"></div>
                </div>
                
                <div class="row detail-row">
                    <div class="col-md-3 detail-label">产品名称</div>
                    <div class="col-md-9 detail-value" th:text="${account.accountName}"></div>
                </div>
                
                <div class="row detail-row">
                    <div class="col-md-3 detail-label">产品ID</div>
                    <div class="col-md-9 detail-value" th:text="${account.instId}"></div>
                </div>
                
                <div class="row detail-row">
                    <div class="col-md-3 detail-label">产品类型</div>
                    <div class="col-md-9 detail-value">
                        <span th:class="'badge ' + (${account.instType == 'SPOT'} ? 'badge-spot' : (${account.instType == 'SWAP'} ? 'badge-swap' : 'badge-futures'))" 
                              th:text="${account.instType}">
                        </span>
                    </div>
                </div>
                
                <div class="row detail-row">
                    <div class="col-md-3 detail-label">余额</div>
                    <div class="col-md-9 detail-value">
                        <span th:text="${account.balance}"></span>
                        <span th:text="${account.currency}" class="ms-2 text-muted"></span>
                    </div>
                </div>
                
                <div class="row detail-row">
                    <div class="col-md-3 detail-label">可用余额</div>
                    <div class="col-md-9 detail-value">
                        <span th:text="${account.available}"></span>
                        <span th:text="${account.currency}" class="ms-2 text-muted"></span>
                    </div>
                </div>
                
                <div class="row detail-row">
                    <div class="col-md-3 detail-label">冻结金额</div>
                    <div class="col-md-9 detail-value">
                        <span th:text="${account.frozen}"></span>
                        <span th:text="${account.currency}" class="ms-2 text-muted"></span>
                    </div>
                </div>
                
                <div class="row detail-row">
                    <div class="col-md-3 detail-label">账户权益</div>
                    <div class="col-md-9 detail-value">
                        <span th:text="${account.equity}"></span>
                        <span th:text="${account.currency}" class="ms-2 text-muted"></span>
                    </div>
                </div>
                
                <div class="row detail-row">
                    <div class="col-md-3 detail-label">未实现盈亏</div>
                    <div class="col-md-9 detail-value">
                        <span th:text="${account.unrealizedProfit}"></span>
                        <span th:text="${account.currency}" class="ms-2 text-muted"></span>
                    </div>
                </div>
                
                <div class="row detail-row">
                    <div class="col-md-3 detail-label">状态</div>
                    <div class="col-md-9 detail-value">
                        <span th:class="'badge ' + (${account.isActive} ? 'bg-success' : 'bg-secondary')"
                              th:text="${account.isActive ? '活跃' : '停用'}">
                        </span>
                    </div>
                </div>
                
                <div class="row detail-row">
                    <div class="col-md-3 detail-label">创建时间</div>
                    <div class="col-md-9 detail-value" th:text="${#dates.format(account.createdAt, 'yyyy-MM-dd HH:mm:ss')}"></div>
                </div>
                
                <div class="row">
                    <div class="col-md-3 detail-label">更新时间</div>
                    <div class="col-md-9 detail-value" th:text="${#dates.format(account.updatedAt, 'yyyy-MM-dd HH:mm:ss')}"></div>
                </div>
            </div>
            <div class="card-footer">
                <div class="d-flex justify-content-between">
                    <a th:href="@{/accounts/edit/{id}(id=${account.id})}" class="btn btn-warning">编辑产品</a>
                    <a th:href="@{/ticker(instId=${account.instId})}" class="btn btn-primary">查看行情</a>
                </div>
            </div>
        </div>
    </div>

    <footer class="container mt-5">
        <hr>
        <p class="text-center text-muted">&copy; 2023 OKX 数据展示系统</p>
    </footer>

    <script th:src="@{/js/bootstrap.bundle.min.js}"></script>
</body>
</html> 